package com.ruoyi.web.controller.applet;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BdmBalanceRechargeRecord;
import com.ruoyi.system.service.IBdmBalanceRechargeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/applet/BalanceRecharge")
public class AppletBalanceRechargeRecordController extends BaseController {

    @Autowired
    private IBdmBalanceRechargeRecordService bdmBalanceRechargeRecordService;



    /**
     * 查询余额充值记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BdmBalanceRechargeRecord bdmBalanceRechargeRecord)
    {
        startPage();
        List<BdmBalanceRechargeRecord> list = bdmBalanceRechargeRecordService.selectBdmBalanceRechargeRecordList(bdmBalanceRechargeRecord);
        return getDataTable(list);
    }

    /**
     * 新增余额充值记录
     */
    @PostMapping
    public AjaxResult add(@RequestBody BdmBalanceRechargeRecord bdmBalanceRechargeRecord)
    {
        return AjaxResult.success(bdmBalanceRechargeRecordService.insertBdmBalanceRechargeRecord(bdmBalanceRechargeRecord));
    }


    /**
     * 余额充值成功后给用户增加余额
     */
    @PutMapping
    public AjaxResult put(@RequestBody BdmBalanceRechargeRecord bdmBalanceRechargeRecord)
    {
        return toAjax(bdmBalanceRechargeRecordService.updateBdmBalanceRechargeRecord(bdmBalanceRechargeRecord));
    }




}
